package com.zz.parkingsystem.entity;

import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 用户表
 * @TableName t_user
 */
@Data
@ApiModel(value = "用户实体类")
public class User implements Serializable {
    /**
     * 用户id
     */
    @ApiModelProperty(value = "用户id")
    private Integer userId;

    /**
     * 账户id
     */
    @ApiModelProperty(value = "账户id")
    private Integer accId;

    /**
     * 登陆电话
     */
    @ApiModelProperty(value = "电话号码")
    private String userTel;

    /**
     * 用户名
     */
    //@NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名")
    private String userName;

    /**
     * 密码
     */
    @NotBlank(message = "密码不能为空")
    @ApiModelProperty(value = "密码")
    private String userPassword;

    /**
     * 盐值
     */
    @ApiModelProperty(value = "盐值")
    private String userSalt;

    /**
     * 是否绑定微信
     */
    @ApiModelProperty(value = "是否绑定微信")
    private Integer userIsWechat;

    /**
     * 0:alive 1:dead
     */
    @ApiModelProperty(value = "用户状态")
    private Integer userStatus;

    /**
     * 0:woman 1：man
     */
    @ApiModelProperty(value = "用户性别")
    private Integer userGender;

    /**
     * 用户头像
     */
    @ApiModelProperty(value = "用户头像")
    private String userAvatar;

    /**
     * 注册时间
     */
    @ApiModelProperty(value = "用户注册时间")
    private Date userCreatedTime;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = "用户修改时间")
    private Date userUpdatedTime;

    /**
     * 最近登陆时间
     */
    @ApiModelProperty(value = "用户最近登录时间")
    private Date userLoginTime;

    /**
     * 预留varchar字段
     */
    private String reservedVar;

    /**
     * 预留int字段
     */
    private Integer reservedInt;

    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        User other = (User) that;
        return (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getAccId() == null ? other.getAccId() == null : this.getAccId().equals(other.getAccId()))
            && (this.getUserTel() == null ? other.getUserTel() == null : this.getUserTel().equals(other.getUserTel()))
            && (this.getUserName() == null ? other.getUserName() == null : this.getUserName().equals(other.getUserName()))
            && (this.getUserPassword() == null ? other.getUserPassword() == null : this.getUserPassword().equals(other.getUserPassword()))
            && (this.getUserSalt() == null ? other.getUserSalt() == null : this.getUserSalt().equals(other.getUserSalt()))
            && (this.getUserIsWechat() == null ? other.getUserIsWechat() == null : this.getUserIsWechat().equals(other.getUserIsWechat()))
            && (this.getUserStatus() == null ? other.getUserStatus() == null : this.getUserStatus().equals(other.getUserStatus()))
            && (this.getUserGender() == null ? other.getUserGender() == null : this.getUserGender().equals(other.getUserGender()))
            && (this.getUserAvatar() == null ? other.getUserAvatar() == null : this.getUserAvatar().equals(other.getUserAvatar()))
            && (this.getUserCreatedTime() == null ? other.getUserCreatedTime() == null : this.getUserCreatedTime().equals(other.getUserCreatedTime()))
            && (this.getUserUpdatedTime() == null ? other.getUserUpdatedTime() == null : this.getUserUpdatedTime().equals(other.getUserUpdatedTime()))
            && (this.getUserLoginTime() == null ? other.getUserLoginTime() == null : this.getUserLoginTime().equals(other.getUserLoginTime()))
            && (this.getReservedVar() == null ? other.getReservedVar() == null : this.getReservedVar().equals(other.getReservedVar()))
            && (this.getReservedInt() == null ? other.getReservedInt() == null : this.getReservedInt().equals(other.getReservedInt()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getAccId() == null) ? 0 : getAccId().hashCode());
        result = prime * result + ((getUserTel() == null) ? 0 : getUserTel().hashCode());
        result = prime * result + ((getUserName() == null) ? 0 : getUserName().hashCode());
        result = prime * result + ((getUserPassword() == null) ? 0 : getUserPassword().hashCode());
        result = prime * result + ((getUserSalt() == null) ? 0 : getUserSalt().hashCode());
        result = prime * result + ((getUserIsWechat() == null) ? 0 : getUserIsWechat().hashCode());
        result = prime * result + ((getUserStatus() == null) ? 0 : getUserStatus().hashCode());
        result = prime * result + ((getUserGender() == null) ? 0 : getUserGender().hashCode());
        result = prime * result + ((getUserAvatar() == null) ? 0 : getUserAvatar().hashCode());
        result = prime * result + ((getUserCreatedTime() == null) ? 0 : getUserCreatedTime().hashCode());
        result = prime * result + ((getUserUpdatedTime() == null) ? 0 : getUserUpdatedTime().hashCode());
        result = prime * result + ((getUserLoginTime() == null) ? 0 : getUserLoginTime().hashCode());
        result = prime * result + ((getReservedVar() == null) ? 0 : getReservedVar().hashCode());
        result = prime * result + ((getReservedInt() == null) ? 0 : getReservedInt().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", userId=").append(userId);
        sb.append(", accId=").append(accId);
        sb.append(", userTel=").append(userTel);
        sb.append(", userName=").append(userName);
        sb.append(", userPassword=").append(userPassword);
        sb.append(", userSalt=").append(userSalt);
        sb.append(", userIsWechat=").append(userIsWechat);
        sb.append(", userStatus=").append(userStatus);
        sb.append(", userGender=").append(userGender);
        sb.append(", userAvatar=").append(userAvatar);
        sb.append(", userCreatedTime=").append(userCreatedTime);
        sb.append(", userUpdatedTime=").append(userUpdatedTime);
        sb.append(", userLoginTime=").append(userLoginTime);
        sb.append(", reservedVar=").append(reservedVar);
        sb.append(", reservedInt=").append(reservedInt);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}